package f.f0.j;

import f.w;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;

/* compiled from: Jdk9Platform */
public final class c extends f {
    public final Method c;
    public final Method d;

    public c(Method method, Method method2) {
        this.c = method;
        this.d = method2;
    }

    public void f(SSLSocket sSLSocket, String str, List<w> list) {
        try {
            SSLParameters sSLParameters = sSLSocket.getSSLParameters();
            List b = f.b(list);
            Method method = this.c;
            Object[] objArr = new Object[1];
            ArrayList arrayList = (ArrayList) b;
            objArr[0] = arrayList.toArray(new String[arrayList.size()]);
            method.invoke(sSLParameters, objArr);
            sSLSocket.setSSLParameters(sSLParameters);
        } catch (IllegalAccessException | InvocationTargetException e) {
            throw f.f0.c.a("unable to set ssl parameters", e);
        }
    }

    @Nullable
    public String i(SSLSocket sSLSocket) {
        try {
            String str = (String) this.d.invoke(sSLSocket, new Object[0]);
            return (str == null || str.equals("")) ? null : str;
        } catch (IllegalAccessException | InvocationTargetException e) {
            throw f.f0.c.a("unable to get selected protocols", e);
        }
    }
}
